<template>
  <div class="user-info-container">
    <div class="user-info-title">
      <span>作者信息</span>
      <div class="article-userinfo-icon"></div>
    </div>
    <el-divider></el-divider>
    <div class="user-detail">
      <el-row>
        <el-col :span="6">
          <el-avatar :src="userInfo.avatar ? userInfo.avatar : 'static/img/tou.jpg'" style="height: 50px ; width: 50px;"/>
        </el-col>
        <el-col :span="18">
          <el-row>
            <el-col :span="8">
              <span class="label">用户ID：</span>
            </el-col>
            <el-col :span="16" >
              <span class="user-nick-name">{{userInfo.userName}}</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <span class="label">昵称：</span>
            </el-col>
            <el-col :span="16">
              <span class="user-nick-name">{{userInfo.nickName}}</span>
            </el-col>
          </el-row>
        </el-col>
      </el-row>
      <el-divider/>
      <div class="user-info-body">
        <el-row style="margin-bottom: 15px">
          <el-col :span="6">
            <span class="label">座右铭：</span>
          </el-col>
          <el-col :span="18">
            <span class="user-info-normal">{{userInfo.perSign}}</span>
          </el-col>
        </el-row>
        <el-row style="margin-bottom: 15px">
          <el-col :span="8">
            <span class="label">电子邮箱：</span>
          </el-col>
          <el-col :span="16">
            <span class="user-info-normal">{{userInfo.email}}</span>
          </el-col>
        </el-row>
        <el-row style="margin-bottom: 15px">
          <el-col :span="6">
            <span class="label">居住地：</span>
          </el-col>
          <el-col :span="18">
            <span class="user-info-normal"><span style="margin-right: 10px">{{userInfo.province}}</span><span>{{userInfo.city}}</span></span>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="6">
            <span class="label">性别：</span>
          </el-col>
          <el-col :span="18">
            <span class="user-info-normal">{{userInfo.sex === '0' ? '男' : userInfo.sex === '1' ? '女' : '未知'}}</span>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    props: {
      userInfo:{
        type: Object,
        default: function(){
          return {
            id: '',
            avatar: '',
            userName: '',
            nickName: ''
          }
        }
      }
    },
    name: "UserInfo-Card"
  }
</script>

<style scoped>
  .user-info-body {
    padding: 10px 0;
  }
  .user-nick-name {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 25px;
    font-size: 12px;
    vertical-align: bottom;
    width: 100%;
  }
  .user-info-normal {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 24px;
    font-size: 14px;
    max-height: 24px;
  }
  .label {
    display: inline-block;
    font-size: 16px;
    line-height: 25px;
    font-weight: bold;
  }
  .user-detail {
    padding: 10px 0;
  }
  .user-info-container /deep/ .el-divider--horizontal {
    margin: 0 0;
  }
  .article-userinfo-icon {
    display: inline-block;
    height: 16px;
    width: 16px;
    vertical-align: text-top;
    background-position: center;
    background-image: url("../../static/img/userinfo.png");
    background-size: 16px;
    background-repeat: no-repeat;
  }
  .user-info-title {
    border-radius: 1vh;
    height: 5vh;
    line-height: 5vh;
    position: relative;
    font-size: 16px;
    font-weight: bold;
    color: rgb(23, 62, 103);
  }
  .user-info-container {
    background-image: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%);
    padding: 10px;
    min-height: 250px;
    border-radius: 15px;
    font-size: 15px;
    box-shadow: 0 0 10px #b6b5b5;
  }
</style>
